package net.awpspace.mp3player.screen;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;

import net.awpspace.mp3player.Application;
import net.awpspace.mp3player.entity.Playlist;

public class AddPlaylistScreen extends Form implements CommandListener {
	private Command cmd_add;
	private TextField text;

	public AddPlaylistScreen() {
		super("Add playlist");
		// TODO Auto-generated constructor stub
		text = new TextField("Playlist name:", "",50, TextField.ANY);
		this.append(text);
		cmd_add = new Command("Save", Command.OK, 1);
		this.addCommand(cmd_add);
		this.setCommandListener(this);
		
		
	}

	public void commandAction(Command c, Displayable arg1) {
		// TODO Auto-generated method stub
		if(c==cmd_add){
			MyPlaylistsScreen.getInstance().add_playlist(new Playlist(text.getString()));
			//MyPlaylistsScreen.getInstance().add_item();
			Application.getDisplay().setCurrent(MyPlaylistsScreen.getInstance());
		}
	}

}
